import request from '@/utils/request'
// 上传
/**
 * 上传
 * @param data  => fileList
 */
export function upLoadFile(data) {
  return request({
    url: `mes/m/file/uploadToServer`,
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data
  })
}
/**
 * 下载
 * @param id
 */
export function downLoadFile(id) {
  return request({
    url: `mes/m/file/downloadFile/${id}`,
    responseType: 'blob',
    method: 'get'
  })
}
/**
 * 删除
 * @param id
 */
export function removeFile(id) {
  return request({
    url: `mes/m/file/delFile/${id}`,
    method: 'get'
  })
}

/**
 * 获取文件流 预览文件
 */
export function filePreview(filePath) {
  return request({
    url: `mes/m/file/fileReview?filePath=${filePath}`,
    method: 'get'
  })
}

export function removeFilePath(path) {
  return request({
    url: `/mes/m/file/delFileByFilePath?filePath=${path}`,
    method: 'get'
  })
}
